<template>
	<view class="indexBig">
		<view class="top">
			<view class="change" v-if="companyInfo.isOpenPrivateOrderInlet == 'yes'" @click="goToPage('personal')">切换个人端
			</view>

			<view class="date-block">
				<view class="line" v-for="line in dateList">
					<view class="d-item" :class="{ active: item.value == currentDate.value }"
						:hideDom="item.value == 'hideDom'" v-for="(item, index) in line" :key="index"
						@click="clickDate(item)">
						{{ item.label }}
					</view>
				</view>
			</view>
		</view>
		<view class="content">
			<view class="hotelBox" v-if="list.length != 0">
				<view class="hotellList" v-for="(item, index) in list" :key="index">
					<view class="hotelInfo" @click="showStoreDet(item)">
						<image :src="item.logo | getImg" mode="aspectFill"></image>
						<view class="topRight">
							<view class="">
								<view class="">{{ item.storeName }}</view>
							</view>
						</view>
					</view>
					<view class="shopContent">
						<view class="shopList" v-for="(foodItem, foodIndex) in item.foodLists" :key="foodIndex">
							<view class="imgContent">
								<u-lazy-load :image="foodItem.foodPic | getImg" :loading-img="loadingImg"
									img-mode=""></u-lazy-load>
								<view class="must" v-if="foodItem.isLimitSelect == '是'">必选</view>
							</view>
							<view class="shopInfo">
								<view class="shopName">{{ foodItem.foodName }}</view>
								<view class="shopDescribe">{{ foodItem.foodDescription }}</view>
								<view class="control">
									<view class="surplus">
										<view v-if="companyInfo.isShowPrice == 'yes'">
											<view>
												<text class="price">
													<text>￥</text>
													{{ foodItem.salePrice }}
												</text>
											</view>
											<view v-if="foodItem.buyedNum != -1">剩余{{ foodItem.buyedNum }}</view>
											<view v-else></view>
										</view>
									</view>
									<view class="specConetnt" v-if="foodItem.hasSpec">
										<view class="selSpec" @click="showSpecAlert(index, foodIndex)">
											<view class="">选规格</view>
										</view>
										<view class="num" v-if="foodItem.num > 0">{{ foodItem.num }}</view>
									</view>
									<view class="showInput" v-else>
										<svg @click="changeShopNum('down', index, foodIndex, foodItem, item)"
											t="1672841614542" class="icon" viewBox="0 0 1024 1024" version="1.1"
											xmlns="http://www.w3.org/2000/svg" p-id="5146" width="18" height="18">
											<path d="M170.666667 469.333333h682.666666v85.333334H170.666667z"
												fill="#444444" p-id="5147"></path>
										</svg>
										<u-input v-model="foodItem.num" :clearable="false" :disabled="true" />
										<svg @click="changeShopNum('add', index, foodIndex, foodItem, item)"
											t="1672841289544" class="icon" viewBox="0 0 1024 1024" version="1.1"
											xmlns="http://www.w3.org/2000/svg" p-id="3814" width="15" height="15">
											<path
												d="M939.939489 459.072557 562.339502 459.072557 562.339502 83.519182 462.055494 83.519182 462.055494 459.072557 84.455507 459.072557 84.455507 559.356564 462.055494 559.356564 462.055494 939.003164 562.339502 939.003164 562.339502 559.356564 939.939489 559.356564Z"
												fill="#272636" p-id="3815"></path>
										</svg>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<u-empty text="没有找到相关数据" mode="page" v-if="list.length == 0"></u-empty>

			<view class="swiperContent" v-if="bannerList && bannerList.length != 0">
				<swiper style="height: 200px" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
					<swiper-item v-for="(item, index) in bannerList" :key="index">
						<view class="imageContent" @click="openNewWindow(item)">
							<image :src="item.bannerUrl | getImg" mode=""></image>
						</view>
					</swiper-item>
				</swiper>
			</view>
			<view class="formContent" id="form">
				<!-- 企业钉钉 不展示姓名部门 -->
				<template v-if="!isDingCompany">
					<view v-if="companyInfo.realNameLogin != 1">
						<view class="">姓名：</view>
						<view class="">
							<u-input type="text" v-model="formData.username" placeholder="请填写收货人姓名"
								:border="true"></u-input>
						</view>
					</view>
					<view v-if="departmentList && departmentList.length">
						<view class="">公司部门：</view>
						<view class=""><u-input v-model="formData.department" type="select" :border="true"
								placeholder="请填写公司部门：" @click="showSelect('department')" /></view>
					</view>
				</template>
				<view class="">
					<view class="">取餐地点：</view>
					<view class=""><u-input v-model="formData.address" type="select" :border="true"
							placeholder="请填写取餐地点：" @click="showSelect('address')" /></view>
				</view>
				<view class="" v-if="pickupTimeList && pickupTimeList.length != 1 && pickupTimeList.length != 0">
					<view class="">取餐时间：</view>
					<view class=""><u-input v-model="formData.pickUpTime" type="select" :border="true"
							placeholder="请填写取餐地点：" @click="showSelect('pickupTime')" /></view>
				</view>
				<view class="">
					<view class="">备注：</view>
					<view class=""><u-input type="textarea" v-model="formData.remark" :border="true"
							placeholder="请填写备注信息" style="min-height: 150rpx"></u-input></view>
				</view>
			</view>
			<view class="shopCarList">
				<view class="title">商品清单：</view>
				<view class="list" v-for="(item, index) in shopCarList" :key="index">
					<view class="">
						{{ item.foodsName }}
						<template v-if="item.foodsSpecificationName">
							(
							<text v-for="(specItem, specIndex) in item.foodsSpecificationName.split(',')"
								:key="specIndex">
								{{ specItem }}
								<text v-if="specIndex != item.foodsSpecificationName.split(',').length - 1">,</text>
							</text>
							)
						</template>
						<text style="margin-left: 10rpx">X {{ item.foodNum }}</text>
					</view>
					<view class="">
						<svg @click="changeShopCarNum('down', index)" t="1672841614542" class="icon"
							viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5146"
							width="18" height="18">
							<path d="M170.666667 469.333333h682.666666v85.333334H170.666667z" fill="#444444"
								p-id="5147"></path>
						</svg>
						<view class="">{{ item.foodNum }}</view>
						<svg @click="changeShopCarNum('add', index)" t="1672841289544" class="icon"
							viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3814"
							width="15" height="15">
							<path
								d="M939.939489 459.072557 562.339502 459.072557 562.339502 83.519182 462.055494 83.519182 462.055494 459.072557 84.455507 459.072557 84.455507 559.356564 462.055494 559.356564 462.055494 939.003164 562.339502 939.003164 562.339502 559.356564 939.939489 559.356564Z"
								fill="#272636" p-id="3815"></path>
						</svg>
					</view>
				</view>
				<u-empty text="请添加商品" mode="page" v-if="shopCarList.length == 0"></u-empty>
			</view>

			<view class="button" @click="submitOrder">确认提交</view>
		</view>

		<commen-footer :checkIndex="1"></commen-footer>
		<!-- 规格选取弹窗 -->
		<view class="specBox">
			<u-popup v-model="specShow" mode="center" :closeable="true">
				<div class="specContent">
					<view>{{ specInfo.specificationName }}</view>
					<view class="specList" v-for="(item, index) in specInfo.specList" :key="index">
						<view class="">{{ item.specificationName }}</view>
						<view class="">
							<view v-for="(specItem, specIndex) in item.nextSpecifications" :key="specIndex"
								:class="{ specCheckList: specItem.checked }" @click="changeSpecCheck(index, specIndex)">
								<view class="">{{ specItem.specificationName }}</view>
							</view>
						</view>
					</view>
				</div>
				<view class="specControl" @click="changeShopNum('spec')">确认</view>
			</u-popup>
		</view>
		<!-- 当前门店资质 -->
		<view class="storeDet">
			<u-popup v-model="storeDetailVisiable" mode="top" @touchmove.stop.prevent="" :closeable="false">
				<view class="storeContent">
					<view class="">{{ clickStoreInfo.name }}--门店资质</view>
					<image :src="item | getImg" mode="aspectFill" v-for="(item, index) in clickStoreInfo.qualifications"
						:key="index"></image>
				</view>
			</u-popup>
		</view>

		<view class="posiBottom">
			<u-popup v-model="selectShow" mode="bottom" :closeable="true" :mask-close-able="true"
				@touchmove.stop.prevent="">
				<view class="posiContent">
					<view class="listContent">
						<view class="list" v-for="(item, index) in selectList" :key="index"
							@click="selectCallBack(index)">{{
								item.text }}</view>
					</view>
				</view>
			</u-popup>
		</view>

		<u-toast ref="uToast"></u-toast>
		<view class="warn"><u-modal v-model="warnShow" content="当前不在点餐时间" :showConfirmButton="true"></u-modal></view>
		<!-- 付款码（非微信端时） -->
		<u-popup v-model="codeVisible" @open="openPayBarcode" @close="closePayBarcode" mode="center" :round="6"
			closeable closeIconPos="top-right" :mask-close-able="false">
			<u-row justify="center" style="padding: 12px; border-bottom: 1px solid #eee">在线支付</u-row>
			<view style="padding: 16px">
				<u-row style="border: 1px solid #eee; padding: 12px; margin-bottom: 12px">
					<u-col span="8">
						订单号：
						<text>
							{{ orderInfo.hcWxPay ? orderInfo.hcWxPay.outTradeNo : '' }}
						</text>
					</u-col>
					<u-col span="4">
						<!-- {{ orderInfo.hcWxPay.amountTotal }} 单位：分 -->
						需支付：<text style="color: #fa690a; font-weight: bold">￥{{
							orderInfo.hcWxPay ? (orderInfo.hcWxPay.amountTotal / 100).toFixed(2) : '' }}</text>
					</u-col>
				</u-row>
				<u-row justify="center" style="padding: 12px; background-color: #e7eef3; border: 1px solid #cad9e4">
					<u-col span="12" justify="center" style="display: flex; margin-bottom: 8px; color: #aaa">
						请使用微信扫码支付，二维码有效期24小时
					</u-col>
					<u-col span="8" justify="center" style="display: flex">
						<div id="pay_qrcode" ref="pay_qrcode"
							style="padding: 16px; width: fit-content; border: 1px solid #eee; border-radius: 4px; background-color: #fff">
						</div>
					</u-col>
				</u-row>
			</view>
		</u-popup>

		<MyLoading :showLoading="showLoading" :text="'正在查询您的支付结果,请稍等'"></MyLoading>
	</view>
</template>

<script>
import QRCode from '@/utils/qrcode'
import CommenFooter from '@/components/footer/companyFooter.vue'
import MyLoading from '@/components/loading/loading.vue'
import {
	isDing,
	companyParams,
	isWechat
} from '@/utils/commen'
import {
	getStoreListWithCompany,
	getCompanyInfo,
	createOrderByCompany,
	loginForCompany,
	getMyInfo,
	queryDateByCompanyId, // 获取公司的点餐日期
	queryByCompanyIdAndDate,
	createCompanyOrder,
	getCompanyOrderStateByCode,
	getCompanyOrderStateByWx
} from '@/utils/req/api.js'
import loadingImg from '@/static/loading.png'

export default {
	components: {
		CommenFooter,
		MyLoading
	},
	data() {
		return {
			companyIds: {},
			isDingCompany: false,

			storeName: '',
			loadingImg,

			list: [],
			specShow: false,
			specInfo: {},
			storeDetailVisiable: false,
			clickStoreInfo: {
				name: '食一家',
				qualifications: [
					'https://yong-shan-tuan.oss-cn-hangzhou.aliyuncs.com/upload/1688993566880_(1688993571950).jpeg'
				],
			},
			storePageNo: 1,
			storePageSize: 10,
			bannerList: [],
			addressList: [],
			departmentList: [],
			pickupTimeList: [],

			closeable: true, //选择框是否可关闭
			maskCloseAble: true, //选择框是否点击遮罩层可关闭
			formData: {},
			selectShow: false,
			selectType: null,
			selectList: [],

			companyInfo: {},
			selectDepartmentInfo: '',
			selectAddressInfo: '',
			selectPickUpTimeInfo: '',
			shopCarList: [], //缓存的商品信息,
			warnShow: false,

			createOrderLock: false,
			dateList: [], // 多日期点餐
			currentDate: {},

			deviceType: '', //设备信息
			codeVisible: false,
			orderInfo: {},
			getPayResTimer: null, //订单状态轮询计时器
			timer: null, //
			tempTimeStr: '',
			showLoading: false
		}
	},
	onLoad(options) {
		if (uni.getStorageSync('hasNotOverCompanyOrder')) {
			console.log("uni.getStorageSync('notOverCompanyOrderParmas')", uni.getStorageSync(
				'notOverCompanyOrderParmas'));
			this.submitOrder(JSON.parse(uni.getStorageSync('notOverCompanyOrderParmas')))
			return;
		}
		this.getSystemInfo();
		if (uni.getStorageSync('companyOrderCreateResult')) {
			this.showLoading = true
			this.tempTimeStr = new Date().getTime()
			clearInterval(this.timer)
			this.timer = setInterval(() => {
				if (!this.searchOrderFlag) {
					this.getPayResut()
				}
				if (new Date().getTime() - this.tempTimeStr > 1000 * 6) {
					this.showLoading = false
					clearInterval(this.timer)
					this.searchOrderFlag = false
					this.tempTimeStr = ''
					uni.removeStorageSync('orderCreateResult')
					uni.removeStorageSync('companyOrderCreateResult')
				}
			}, 1000)
		}

		// onLoad({ id: companyId }) {
		console.log('企业单的options', options, 'corpId:', options.corpId, 'corpld:', options.corpld, 'clientId', options
			.clientId)
		let {
			id: companyId,
			corpId,
			clientId
		} = options;
		companyId && companyParams({
			companyId,
			clientId,
			corpId,
		}) // setter
		if (corpId && clientId && !uni.getStorageSync('token')) {
			uni.navigateTo({
				url: `/pages/login/login?id=${companyId}&corpId=${corpId}&clientId=${clientId}`
			})
			return
		}
		this.companyIds = companyParams() // getter
		console.log('钉钉信息', this.companyIds);
		const {
			clientId: _clientId,
			corpId: _corpId
		} = this.companyIds
		this.isDingCompany = _clientId && _corpId // 钉钉企业单链接携带此参数
		console.log('isDingCompany', this.isDingCompany);

		uni.setStorageSync('isFromCompany', true)

		this.initMyInfo()
		this.init()
	},
	onShow() {
	},
	computed: {},
	watch: {
		shopCarList: {
			handler(newName, oldName) {
				console.log('newName', newName)
			},
			immediate: true,
			deep: true,
		},
	},
	methods: {
		async getSystemInfo() {
			let system = await uni.getSystemInfo();
			console.log('system', system);
			const [, deviceInfo] = await uni.getSystemInfo()
			this.deviceInfo = deviceInfo;
			if (deviceInfo.deviceType == 'pc') {
				this.deviceType = 'pc';
			} else {
				if (isWechat()) {
					this.deviceType = 'wechat';
				} else {
					this.deviceType = 'h5';
				}
			}
			console.log('this.deviceType', this.deviceType);
		},
		async initMyInfo() {
			const myInfo = uni.getStorageSync('myInfo')
			console.log('[myInfo] :', myInfo)
			if (myInfo) {
				this.formData.username = myInfo.nameTakingMeal
			}
		},
		// 初始化数据，获取店铺信息及菜单列表
		async init() {
			let isMultipleDatesOrder = await this._getCompanyInfo()
			if (!isMultipleDatesOrder) {
				this._getStoreListWithCompany()
				return
			}

			// 多日期点餐往下走
			const {
				companyId
			} = this.companyIds
			let res = await queryDateByCompanyId({
				companyId
			})
			if (!res.data.success) {
				this.$showToast.call(this, '点餐日期数据为空', 'warn')
				return
			}

			let dateList = res.data.result || []
			if (dateList.length == 0) {
				this.$showToast.call(this, '点餐日期数据为空', 'warn')
				return
			}

			this._getStoreListWithCompany(dateList[0])
			this.dateList = []
			let list = []
			dateList.forEach((val, index) => {
				let arrIndex = Math.floor(index / 3)
				if (!list[arrIndex]) {
					list[arrIndex] = []
				}
				let arr = val.split('-')
				list[arrIndex][index % 3] = {
					value: val,
					label: arr[1] + '月' + arr[2] + '日',
				}
			})
			let lastArr = list[list.length - 1]
			while (lastArr.length < 3) {
				lastArr.push({
					value: 'hideDom',
				})
			}
			this.currentDate = list[0][0]
			this.dateList = list
		},

		// 点击选择日期
		clickDate(date) {
			if (date.value == this.currentDate.value) {
				return
			}
			if (this.shopCarList.length) {
				this.shopCarList = []
			}
			this.currentDate = date
			this._getStoreListWithCompany(date.value)
		},

		//获取商品列表信息
		async _getStoreListWithCompany(date) {
			let res
			const {
				companyId
			} = this.companyIds

			if (date) {
				res = await queryByCompanyIdAndDate({
					companyId,
					date
				})
			} else {
				res = await getStoreListWithCompany({
					companyId
				})
			}

			if (res.data.message != 'Token失效，请重新登录!') {
				uni.removeStorageSync('isFromCompany')
			}
			if (res.data.code == 200) {
				if (res.data.result) {
					res.data.result.forEach(item => {
						item.foodLists.forEach(childItem => {
							childItem.num = 0
							console.log('childItem.isUseSpecifications', childItem
								.isUseSpecifications)
							if (childItem.isUseSpecifications == 'yes') {
								childItem.hasSpec = true
							}
						})
					})
					this.list = res.data.result
				}
				console.log('this.list', this.list)
			}
		},
		async _getCompanyInfo() {
			const {
				companyId
			} = this.companyIds
			let res = await getCompanyInfo({
				id: companyId
			})
			if (res.data.result.realNameLogin == 1) {
				if (!uni.getStorageSync('hasCompanyLogin')) {
					uni.navigateTo({
						url: '/pages/companyMemberLogin'
					})
				}
			}
			uni.setStorageSync('companyInfo', res.data.result)
			this.companyInfo = res.data.result
			console.log('公司信息res', res)
			this.bannerList = res.data.result.companyBanners || []
			this.addressList = res.data.result.companyPickupAddresses || []
			this.departmentList = res.data.result.companyDepartments || []
			console.log('departmentList', this.departmentList)
			console.log('pickupTimeList', this.pickupTimeList)

			let myCompanyOrderInfo = uni.getStorageSync('myCompanyOrderInfo')
			console.log('myCompanyOrderInfo', myCompanyOrderInfo);
			if (res.data.result.realNameLogin != 1) {
				if (myCompanyOrderInfo) {
					this.formData.username = myCompanyOrderInfo.username
				}
			}
			res.data.result.companyPickupAddresses.forEach(item => {
				item.text = item.pickupAddress
				if (myCompanyOrderInfo) {
					if (item.id == myCompanyOrderInfo.pickupAddressId) {
						this.formData.address = item.text
						this.formData.selectAddressInfo = item
					}
				}
			})
			res.data.result.companyDepartments.forEach(item => {
				item.text = item.departmentName
				if (myCompanyOrderInfo) {
					if (item.id == myCompanyOrderInfo.departmentId) {
						this.formData.department = item.text
						this.formData.selectDepartmentInfo = item
					}
				}
			})
			let pickupTimeList = []
			res.data.result.pickupTime.split(',').forEach(item => {
				pickupTimeList.push({
					text: item,
				})
				if (myCompanyOrderInfo) {
					if (item == myCompanyOrderInfo.pickUpTime) {
						this.formData.pickUpTime = item
						this.formData.selectPickUpTimeInfo = item
					}
				}
			})
			this.pickupTimeList = pickupTimeList

			this.warnShow = this.checkPayTime()

			return res.data.result.isMultipleDatesOrder == 'yes'
		},

		checkPayTime() {
			if (this.companyInfo.state == 'no') {
				return true
			}
			let {
				startTime,
				endTime
			} = this.companyInfo
			let hour = new Date().getHours()
			let miute = new Date().getMinutes()
			let secound = new Date().getSeconds()
			let year = new Date().getFullYear()
			let month = new Date().getMonth() + 1
			let day = new Date().getDate()
			let fullDate = `${year}/${month}/${day}`
			let fullStartTime = `${fullDate} ${startTime}`
			let fullEndTime = `${fullDate} ${endTime}`
			let startTimeStemp = new Date(fullStartTime).getTime()
			let endTimeStemp = new Date(fullEndTime).getTime()
			if (startTimeStemp < endTimeStemp) {
				if (new Date().getTime() < startTimeStemp || new Date().getTime() > endTimeStemp) {
					return true
				} else {
					return false
				}
			} else {
				if (new Date().getTime() < startTimeStemp && new Date().getTime() + 24 * 60 * 60 * 1000 >
					endTimeStemp + 24 * 60 * 60 * 1000) {
					return true
				} else {
					return false
				}
			}
		},
		goToPage(type) {
			let url
			switch (type) {
				case 'personal':
					url = '/pages/index/index?froms=company'
					break
			}
			uni.navigateTo({
				url,
			})
		},
		//展示商品规格选择弹窗
		showSpecAlert(shopIndex, foodIndex) {
			let checkItem = this.list[shopIndex].foodLists[foodIndex]
			let specList = checkItem.specifications
			console.log('specList', specList)
			specList.forEach(item => {
				item.nextSpecifications.forEach((childItem, childIndex) => {
					childIndex == 0 ? (childItem.checked = true) : (childItem.checked = false)
				})
			})
			this.specInfo = {
				shopIndex,
				foodIndex,
				shopId: checkItem.id,
				specList,
				name: checkItem.specificationName,
				buyedNum: this.list[shopIndex].foodLists[foodIndex].buyedNum,
				buyedNum: this.list[shopIndex].foodLists[foodIndex].buyedNum,
				merchantId: this.list[shopIndex].id,
			}
			this.specShow = true
			console.log('specInfo', this.specInfo)
		},
		//展示列表的购物车加减以及规格弹窗的添加至购物车
		async changeShopNum(type, shopCheckIndex, foodCheckIndex, value, listValue) {
			if (type == 'spec' && this.specInfo.buyedNum > -1 && this.specInfo.num >= this.specInfo.buyedNum) {
				this.$showToast.call(this, '库存不足，无法继续添加', 'default')
				return
			}
			if (type == 'add' && value.buyedNum > -1 && value.buyedNum <= 0) {
				this.$showToast.call(this, '库存不足，无法继续添加', 'default')
				return
			}
			if (type == 'down') {
				if (value.num == 0) {
					return
				}
			}

			if (type == 'spec') {
				let merchantIndex = this.specInfo.shopIndex
				let foodIndex = this.specInfo.foodIndex
				let {
					id,
					foodName
				} = this.list[merchantIndex].foodLists[foodIndex]
				this.list[merchantIndex].foodLists[foodIndex].num++
				if (this.list[merchantIndex].foodLists[foodIndex].buyedNum != -1) {
					this.list[merchantIndex].foodLists[foodIndex].buyedNum--
				}
				this.specShow = false

				//缓存购物车数据
				let tempArr = []
				let tempNameArr = []
				this.specInfo.specList.forEach(item => {
					item.nextSpecifications.forEach(childItem => {
						if (childItem.checked) {
							tempArr.push(childItem.id)
							tempNameArr.push(childItem.specificationName)
						}
					})
				})
				let specIds = tempArr.join(',')
				let specNames = tempNameArr.join(',')
				let flag = false
				if (this.shopCarList.length != 0) {
					for (let i = 0; i < this.shopCarList.length; i++) {
						if (this.shopCarList[i].foodsId == id && this.shopCarList[i].foodsSpecificationId ==
							specIds) {
							this.shopCarList[i].foodNum++
							flag = true
							break
						}
					}
					if (!flag) {
						this.shopCarList.push({
							merchantId: this.list[merchantIndex].id,
							foodNum: 1,
							foodsId: id,
							foodsName: foodName,
							foodsSpecificationId: specIds,
							foodsSpecificationName: specNames,
						})
					}
				} else {
					this.shopCarList.push({
						merchantId: this.list[merchantIndex].id,
						foodNum: 1,
						foodsName: foodName,
						foodsId: id,
						foodsSpecificationId: specIds,
						foodsSpecificationName: specNames,
					})
				}
			} else {
				let checkInfo = this.list[shopCheckIndex].foodLists[foodCheckIndex]
				console.log('checkInfo', checkInfo.id, this.shopCarList)
				let {
					num,
					buyedNum,
					id,
					foodName
				} = checkInfo

				this.list[shopCheckIndex].foodLists[foodCheckIndex].num = type == 'down' ? (num - 1 <= 0 ? 0 :
					num - 1) : num + 1
				if (checkInfo.buyedNum != '-1') {
					this.list[shopCheckIndex].foodLists[foodCheckIndex].buyedNum = type == 'down' ? buyedNum + 1 :
						buyedNum - 1
				}

				//缓存购物车
				if (type == 'add') {
					let flag = false
					if (this.shopCarList.length != 0) {
						for (let i = 0; i < this.shopCarList.length; i++) {
							if (this.shopCarList[i].foodsId == id) {
								this.shopCarList[i].foodNum++
								flag = true
								break
							}
						}
						if (!flag) {
							this.shopCarList.push({
								merchantId: this.list[shopCheckIndex].id,
								foodNum: 1,
								foodsId: id,
								foodsName: foodName,
								foodsSpecificationId: null,
							})
						}
					} else {
						this.shopCarList.push({
							merchantId: this.list[shopCheckIndex].id,
							foodNum: 1,
							foodsId: id,
							foodsName: foodName,
							foodsSpecificationId: null,
						})
					}
				} else {
					for (let i = 0; i < this.shopCarList.length; i++) {
						let item = this.shopCarList[i]
						if (item.foodsId == id) {
							console.log('?????')
							if (item.foodNum != 1) {
								this.shopCarList[i].foodNum--
							} else {
								this.shopCarList.splice(i, 1)
							}
						}
					}
				}
			}
		},
		//更改规格的选中状态
		changeSpecCheck(listIndex, childIndex) {
			this.specInfo.specList[listIndex].nextSpecifications.forEach((item, index) => {
				if (index == childIndex) {
					this.$set(this.specInfo.specList[listIndex].nextSpecifications[index], 'checked', true)
				} else {
					this.$set(this.specInfo.specList[listIndex].nextSpecifications[index], 'checked', false)
				}
			})
			this.$forceUpdate()
		},
		//购物车数量加减
		changeShopCarNum(type, index) {
			let {
				foodsId,
				foodNum,
				merchantId,
				foodsSpecificationId
			} = this.shopCarList[index]
			console.log('this.companyInfo.isLimitOrder', this.companyInfo.isLimitOrder)

			let merchantIndex = '',
				foodIndex = ''
			for (let i = 0; i < this.list.length; i++) {
				let item = this.list[i]
				merchantIndex = i
				if (item.id == merchantId) {
					for (let j = 0; j < item.foodLists.length; j++) {
						let foodItem = item.foodLists[j]
						if (foodItem.id == foodsId) {
							foodIndex = j
							break
						}
					}
					break
				}
			}
			this.shopCarList[index].foodNum = type == 'add' ? foodNum + 1 : foodNum - 1
			this.list[merchantIndex].foodLists[foodIndex].num = type == 'add' ? foodNum + 1 : foodNum - 1
			if (this.shopCarList[index].foodNum == 0) {
				this.shopCarList.splice(index, 1)
			}
		},
		//展示门店资质
		showStoreDet(value) {
			this.clickStoreInfo = {
				name: value.storeName,
				qualifications: value.qualifications.split(','),
			}
			this.storeDetailVisiable = true
		},
		openNewWindow(value) {
			if (value.bannerPath) {
				window.location.href = value.bannerPath
			}
		},
		actionSheetCallback(e) {
			console.log('e', e)
		},
		//展示下拉
		showSelect(type) {
			this.selectType = type
			console.log('selectType', this.selectType)
			let list
			if (type == 'address') {
				list = this.addressList
			} else if (type == 'pickupTime') {
				list = this.pickupTimeList
			} else if (type == 'department') {
				list = this.departmentList
			}
			this.selectList = list
			console.log('this.selectList', this.selectList)
			this.selectShow = true
		},
		//
		selectCallBack(e) {
			console.log('e', e)
			let {
				text
			} = this.selectList[e]
			if (this.selectType == 'address') {
				this.formData.address = text
				this.formData.selectAddressInfo = this.selectList[e]
				console.log('this.formData.selectAddressInfo', this.formData.selectAddressInfo)
			} else if (this.selectType == 'department') {
				console.log('!!!!')
				this.formData.department = text
				this.formData.selectDepartmentInfo = this.selectList[e]
			} else if (this.selectType == 'pickupTime') {
				this.formData.pickUpTime = text
				this.formData.selectPickUpTimeInfo = this.selectList[e]
			}
			this.selectShow = false
		},
		async submitOrder(notOverCompanyOrderParmas) {
			if (notOverCompanyOrderParmas.userId) {
				if (uni.getStorageSync('companyOrderTimeStemp') && new Date().getTime() - uni.getStorageSync(
					'companyOrderTimeStemp') < 1000 * 30) {
					return
				}
				uni.setStorageSync('myCompanyOrderInfo', notOverCompanyOrderParmas)
				const _res = await createCompanyOrder(notOverCompanyOrderParmas);
				uni.setStorageSync('companyOrderTimeStemp', new Date().getTime());
				this.formatResult(_res, notOverCompanyOrderParmas);
				return;
			}
			console.log('我是提交函数，我触发了')

			if (this.checkPayTime()) {
				this.$showToast.call(this, '现在不在下单时间', 'default')
				return
			}
			if (!this.shopCarList || this.shopCarList.length == 0) {
				this.$showToast.call(this, '请选择餐品', 'default')
				return
			}
			uni
				.createSelectorQuery()
				.select('#form')
				.boundingClientRect(data => {
					uni.pageScrollTo({
						duration: 100,
						scrollTop: data.top,
					})
				})
				.exec()
			let whitePaperList = this.companyInfo.whitePaper ? this.companyInfo.whitePaper.split(',') : []
			if (this.companyInfo.isLimitOrder == 'yes') {
				if (!whitePaperList.includes(this.formData.username)) {
					if (this.shopCarList.length > 1) {
						this.$showToast('每人每天限点一份', 'default')
						return
					}
					if (this.shopCarList.length == 1) {
						if (this.shopCarList[0].foodNum > 1) {
							this.$showToast('每人每天限点一份', 'default')
							return
						}
					}
				}
			}

			// 非企业钉钉
			if (!this.isDingCompany) {
				if (!this.formData.username) {
					this.$showToast.call(this, '请填写姓名', 'default')
					return
				}
				if (this.departmentList.length) {
					if (!this.formData.department) {
						this.$showToast.call(this, '请选择部门名称', 'default')
						return
					}
				}
			}

			if (this.addressList.length) {
				if (!this.formData.address) {
					this.$showToast.call(this, '请选择取餐地址', 'default')
					return
				}
			}

			if (this.pickupTimeList.length != 0 && this.pickupTimeList.length != 1) {
				if (!this.formData.pickUpTime) {
					this.$showToast.call(this, '请选择取餐时间', 'default')
					return
				}
			}


			if (!uni.getStorageSync('token') && !this.isDingCompany) {
				let loginRes = await loginForCompany({
					name: this.formData.username,
				})
				uni.setStorageSync('token', loginRes.data.result.token)

				let myInfoResult = await getMyInfo()
				uni.setStorageSync('myInfo', myInfoResult.data.result)
				console.log('****', myInfoResult.data.result)
			}

			const {
				companyId
			} = this.companyIds
			let obj = {
				userId: uni.getStorageSync('myInfo').id,
				companyId,
				companyOrderDaos: this.shopCarList,
				pickupAddressId: this.formData.selectAddressInfo.id,
				remark: this.formData.remark,
				username: this.formData.username,
			}
			console.log('obj', obj)
			if (!this.isDingCompany) {
				if (this.departmentList.length) {
					obj.departmentId = this.formData.selectDepartmentInfo.id
				}
			}
			if (this.pickupTimeList.length) {
				obj.pickUpTime = this.formData.pickUpTime
			}
			if (!obj.pickUpTime) {
				obj.pickUpTime = this.pickupTimeList[0].text
			}

			// 多日期点餐
			if (this.currentDate.value) {
				obj.deliveryTime = this.currentDate.value
			}

			//钉钉--调用原支付接口
			if (this.isDingCompany) {
				if (this.createOrderLock) {
					// this.$showToast.call(this, '正在等待返回下单结果，请稍等', 'default')
					uni.showToast({
						title: '正在等待返回下单结果，请稍等',
						icon: 'none'
					})
					return
				}
				this.createOrderLock = true
				let res = await createOrderByCompany(obj)
				this.createOrderLock = false
				uni.setStorageSync('companyShopCarList', this.shopCarList)
				if (res.data.success) {
					uni.setStorageSync('myCompanyOrderInfo', obj)
					uni.setStorageSync('createOrderTime', new Date().getTime())

					uni.removeStorageSync('companyOrderCreateResult')
					uni.removeStorageSync('hasNotOverCompanyOrder');
					uni.removeStorageSync('notOverCompanyOrderParmas');

					// this.$showToast.call(this, '订单提交成功', 'success')
					uni.showToast({
						title: '订单提交成功',
						icon: 'none'
					})
					uni.navigateTo({
						url: '/pages/company/createOrderSuccess',
					})

				} else {
					// this.$showToast.call(this, res.data.message, 'wanring')
					uni.showToast({
						title: res.data.message,
						icon: 'none'
					})
					uni.removeStorageSync('companyOrderCreateResult')
					uni.removeStorageSync('hasNotOverCompanyOrder');
					uni.removeStorageSync('notOverCompanyOrderParmas');
				}
			} else {
				console.log('this.deviceType', this.deviceType);
				let res;
				uni.setStorageSync('companyShopCarList', this.shopCarList)
				if (!notOverCompanyOrderParmas.userId) {
					if (this.deviceType == 'pc') {
						obj.paymentMethod = 'pc_wx';
					} else if (this.deviceType == 'wechat') {
						obj.paymentMethod = 'wxpay';
						obj.wxPayType = 'jsapi';
					} else if (this.deviceType == 'h5') {
						obj.paymentMethod = 'wxpay';
						obj.wxPayType = 'h5';
					}
					console.log('obj', obj);
					uni.setStorageSync('myCompanyOrderInfo', obj)
					res = await createCompanyOrder(obj);
				} else {
					uni.setStorageSync('myCompanyOrderInfo', notOverCompanyOrderParmas)
					console.log('notOverCompanyOrderParmas', notOverCompanyOrderParmas);
					res = await createCompanyOrder(notOverCompanyOrderParmas);

				}
				console.log('订单res', res);
				this.formatResult(res, obj);
			}
		},
		formatResult(res, payParams) {
			if (res.data.success) {
				this.orderInfo = res.data.result;
				if (this.orderInfo) {
					uni.setStorageSync('companyOrderCreateResult', JSON.stringify(this.orderInfo))
				}
				if (!this.orderInfo.hcWxPay) {
					uni.setStorageSync('myCompanyOrderInfo', payParams)
					uni.setStorageSync('createOrderTime', new Date().getTime())
					// this.$showToast.call(this, '订单提交成功', 'success')
					uni.showToast({
						title: '订单提交成功',
						icon: 'none'
					})

					uni.removeStorageSync('companyOrderCreateResult')
					uni.removeStorageSync('hasNotOverCompanyOrder');
					uni.removeStorageSync('notOverCompanyOrderParmas');

					uni.navigateTo({
						url: '/pages/company/createOrderSuccess',
					})
				} else {
					if (this.deviceType == 'pc') {
						this.codeVisible = true
					} else if (this.deviceType == 'wechat') {
						console.log('我是微信环境')
						let {
							appid,
							timeStamp,
							nonceStr,
							packageValue,
							signType,
							paySign
						} = res.data.result.hcWxPay
						this.wxPay({
							appid,
							timeStamp,
							nonceStr,
							packageValue,
							signType,
							paySign
						});
					} else if (this.deviceType == 'h5') {
						this.h5Pay(this.orderInfo.hcWxPay.h5Url)
					}
				}
			} else {
				if (res.data.message == '请先授权微信登录') {
					if (uni.getStorageSync('hasReturnFlag')) {
						console.log('我又要跳转了');
						return;
					}
					uni.setStorageSync('hasReturnFlag', true);
					uni.setStorageSync('hasNotOverCompanyOrder', 'true');
					uni.setStorageSync('notOverCompanyOrderParmas', JSON.stringify(payParams));
					window.location.href =
						'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx50c118fbe2e4490f&response_type=code&scope=snsapi_base&state=abcdefghigklmnopqrstuvwxyz&redirect_uri=https://www.yongshantuan.cn/#wechat_redirect'
				} else {
					// this.$showToast.call(this, res.data.message, 'warning');
					uni.showToast({
						title: res.data.message,
						icon: 'none'
					})

					uni.removeStorageSync('companyOrderCreateResult')
					uni.removeStorageSync('hasNotOverCompanyOrder');
					uni.removeStorageSync('notOverCompanyOrderParmas');
				}
			}

		},
		// 付款码 START ---
		openPayBarcode() {
			const {
				hcWxPay: {
					qrCode
				},
				paymentId
			} = this.orderInfo;
			console.log('qrCode', qrCode);
			new QRCode(this.$refs.pay_qrcode, {
				text: qrCode, // 需要转换为二维码的内容
				width: 180,
				height: 180,
				colorDark: '#000000',
				colorLight: '#ffffff',
			})
			clearInterval(this.getPayResTimer)
			this.getPayResTimer = setInterval(async () => {
				const res = await getCompanyOrderStateByCode({
					paymentId
				})
				if (res.data.success) {
					if (res.data.result.state == '已付款') {
						// this.$showToast.call(this, '付款成功')
						uni.showToast({
							title: '付款成功',
							icon: 'none'
						})

						uni.removeStorageSync('companyOrderCreateResult')
						uni.removeStorageSync('hasNotOverCompanyOrder');
						uni.removeStorageSync('notOverCompanyOrderParmas');

						this.isPayBarcode = false // 关闭付款码
						clearInterval(this.getPayResTimer)
						uni.navigateTo({
							url: '/pages/company/createOrderSuccess',
						})
					} else {
						// this.$showToast.call(this, res.data.message, 'default', 5000)
						uni.showToast({
							title: res.data.message,
							icon: 'none'
						})
						uni.removeStorageSync('companyOrderCreateResult')
						uni.removeStorageSync('notOverCompanyOrderParmas');
						uni.removeStorageSync('companyOrderCreateResult')
					}
				}
			}, 2000)
		},
		closePayBarcode() {
			uni.removeStorageSync('companyOrderCreateResult')
			uni.removeStorageSync('notOverCompanyOrderParmas');
			uni.removeStorageSync('companyOrderCreateResult')
			clearInterval(this.getPayResTimer)
		},
		// 付款码 END ---
		wxPay({
			appid,
			timeStamp,
			nonceStr,
			packageValue,
			signType,
			paySign
		}) {
			console.log('我进入支付函数了')
			WeixinJSBridge.invoke(
				'getBrandWCPayRequest', {
				appId: appid, //公众号ID，由商户传入
				timeStamp, //时间戳，自1970年以来的秒数
				nonceStr, //随机串
				package: packageValue,
				signType, //微信签名方式：
				paySign, //微信签名
			},
				res => {
					if (res.err_msg == 'get_brand_wcpay_request:ok') {
						console.log('微信支付结果')
						if (res.data) {
							this.getPayResut()
						}
					} else {
						// this.$showToast.call(this, '您已取消支付', 'default')
						uni.showToast({
							title: '您已取消支付',
							icon: 'none'
						})
						uni.removeStorageSync('companyOrderCreateResult')
					}
				}
			)
		},
		async getPayResut() {
			this.searchOrderFlag = true
			let {
				paymentId
			} = JSON.parse(uni.getStorageSync('companyOrderCreateResult'))
			console.log('paymentId', paymentId);
			let payResult = await getCompanyOrderStateByWx({
				paymentId
			})
			console.log('payResult', payResult, 'paymentId', paymentId)
			if (payResult.data.success) {
				if (payResult.data.result.state == '已付款') {
					this.showLoading = false
					let obj = JSON.parse(JSON.stringify(payResult.data.result))
					obj.addressInfo = this.selectAddressInfo;
					uni.setStorageSync('successOrderInfo', JSON.stringify(obj))
					// this.$showToast.call(this, '下单成功')
					uni.showToast({
						title: '下单成功',
						icon: 'none'
					})
					clearInterval(this.timer)
					uni.removeStorageSync('companyOrderCreateResult')
					uni.removeStorageSync('hasNotOverCompanyOrder');
					uni.removeStorageSync('notOverCompanyOrderParmas');

					uni.navigateTo({
						url: '/pages/company/createOrderSuccess'
					})
				} else {
					clearInterval(this.timer)
					// this.$showToast.call(this, payResult.data.message, 'default', 5000)
					uni.showToast({
						title: payResult.data.message,
						icon: 'none'
					})
					uni.removeStorageSync('companyOrderCreateResult')
					this.searchOrderFlag = false
					this.showLoading = false
				}
			}
		},
		h5Pay(url) {
			window.location.href = url
		}
	}
}
</script>

<style lang="scss" scoped>
* {
	padding: 0;
	margin: 0;
}

.indexBig {
	min-height: 100vh;
	background: linear-gradient(104.49deg, #ff602e 1.8%, #f96a02 103.57%);
	background-size: 100% 100vh;
	background-repeat: no-repeat;
	overflow: hidden;
}

.top {
	min-height: 160rpx;

	.change {
		font-size: 30rpx;
		color: #fff;
		margin-left: 40rpx;
		padding-top: 60rpx;
	}

	.date-block {
		padding: 20px 15px 0px;

		.line {
			display: flex;
			justify-content: space-between;

			&+.line {
				margin-top: 10px;
			}
		}

		.d-item {
			color: #333;
			font-size: 14px;
			padding: 4px 0px;
			background-color: #fff;
			border: 1px solid #656666;
			cursor: pointer;
			width: 90px;
			text-align: center;

			&.active {
				border: 1px solid #fff;
				color: red;
			}
		}

		.d-item[hideDom='true'] {
			visibility: hidden;
		}
	}
}

.content {
	background-color: #f5f5f5;
	min-height: 90vh;
	margin: 40rpx 0 0 0;
	border-top-left-radius: 40rpx;
	border-top-right-radius: 40rpx;
	padding-bottom: 200rpx;
	padding-top: 40rpx;

	/deep/ {
		.u-empty {
			padding: 80rpx 0;
			background-color: #fff;
			width: calc(100% - 40rpx);
			margin: 0 auto;
			border-radius: 10rpx;
		}
	}
}

.hotelBox {
	padding: 0 20rpx;
}

.hotellList {
	border-radius: 40rpx;
	padding: 40rpx 20rpx;
	background-color: #fff;
	margin-bottom: 40rpx;

	.hotelInfo {
		@include flexs();
		position: relative;

		.fixBox {
			width: 100%;
			height: 100%;
			position: absolute;
			left: 0;
			top: 0;
			background-color: rgba(0, 0, 0, 0.55);
			color: #fff;
			font-size: 32rpx;
			@include flexs(center, center);
		}

		image {
			width: 100rpx;
			height: 100rpx;
			border-radius: 10rpx;
			flex-shrink: 0;
		}

		.topRight {
			width: calc(100% - 170rpx);
			margin-left: 20rpx;
			@include flexs(space-between, flex-start);
			flex-direction: column;

			>view:nth-child(1) {
				width: 100%;
				@include flexs(space-between, center);

				>view:nth-child(1) {
					font-size: 32rpx;
					font-weight: bold;
					flex: 1;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}

				>.notEnd {
					@include flexs(flex-end, center);
					width: 37%;
					flex-shrink: 0;
					font-size: 22rpx;
					color: rgba(0, 0, 0, 0.55);

					>view:nth-child(1) {
						margin-left: 10rpx;
						background: linear-gradient(271.21deg, #f25b48 -4.12%, #f68758 99.23%);
						color: #fff;
						padding: 0 5rpx;
						border-bottom-left-radius: 5rpx;
						border-top-left-radius: 5rpx;
					}

					>view:nth-child(2) {
						background: #ffdddd;
						padding: 0 5rpx;
						color: #ff0000;
						font-weight: bold;
						border-top-right-radius: 5rpx;
						border-bottom-right-radius: 5rpx;
					}
				}

				>.end {
					background-color: #e9ebed;
					border-radius: 20rpx;
					color: rgba(0, 0, 0, 0.55);
					font-size: 22rpx;
					line-height: 1.5;
					padding: 0 10rpx;

					text {
						color: #040404;
						margin-left: 10rpx;
					}
				}
			}

			>view:nth-child(2) {
				@include flexs(flex-start, center);
				font-size: 24rpx;
				line-height: 2;
				width: 100%;

				>view {
					width: calc(100% / 3);
					flex: 1;
				}

				text {
					color: #f52a2a;
					margin-left: 10rpx;
				}
			}

			>view:nth-child(3) {
				width: 100%;
				@include flexs(space-between, center);
				font-size: 22rpx;
				line-height: 2;
			}

			>view:nth-child(4) {
				width: 100%;
				@include flexs(space-between, center);
				font-size: 22rpx;
				line-height: 2;
			}
		}
	}

	.shopContent {
		@include flexs(space-between, flex-start);
		padding: 20rpx 0;
		flex-wrap: wrap;

		.shopList {
			width: calc((100% - 20rpx) / 2);
			margin-bottom: 20rpx;

			.imgContent {
				padding-bottom: calc(30 / 38 * 100%);
				position: relative;
				overflow: hidden;

				.must {
					position: absolute;
					right: 10rpx;
					top: 10rpx;
					background-color: #fa690a;
					color: #fff;
					font-size: 20rpx;
					border-radius: 5rpx;
					padding: 0 10rpx;
					line-height: 1.5;
					font-weight: bold;
				}

				image {
					position: absolute;
					left: 0;
					top: 0;
					bottom: 0;
					right: 0;
					max-width: 100%;
					max-height: 100%;
					margin: auto;
					width: auto;
					height: auto;
				}
			}
		}

		.shopInfo {
			padding: 10rpx 0;

			.shopName {
				font-size: 28rpx;
				line-height: 1.5;
			}

			.shopDescribe {
				min-height: 48rpx;
				font-size: 24rpx;
				line-height: 2;
				color: rgba(0, 0, 0, 0.35);
				margin-bottom: 10rpx;
				text-overflow: ellipsis;
				overflow: hidden;
				white-space: nowrap;
			}

			.control {
				@include flexs(space-between, center);
				font-size: 24rpx;
				position: relative;

				.surplus {
					color: rgba(0, 0, 0, 0.55);
					@include flexs(flex-start, center);
					flex-wrap: wrap;
				}

				.price {
					font-size: 32rpx;
					color: #fa690a;
					font-weight: bold;
					margin-right: 10rpx;

					text {
						font-size: 24rpx;
						font-weight: 400;
					}
				}

				.specConetnt {
					background: #fa690a;
					border-radius: 4px;
					padding: 5rpx 10rpx;
					color: #fff;
				}

				.num {
					width: 30rpx;
					height: 30rpx;
					font-size: 20rpx;
					border-radius: 50%;
					background-color: #f60000;
					position: absolute;
					right: -10rpx;
					top: -10rpx;
					line-height: 30rpx;
					text-align: center;
					color: #fff;
				}

				.showInput {
					width: 50%;
					@include flexs(center, center);
					color: #00000080;
					border-radius: 50rpx;
					border: 1px solid #eee;

					svg {
						margin: 0 10rpx;
					}

					view {
						width: 50rpx;
						height: 50rpx;
						text-align: center;
						line-height: 25rpx;
						font-size: 20px;
					}
				}
			}
		}
	}
}

.specBox {
	/deep/.u-mode-center-box {
		min-height: auto;
	}

	.specContent {
		min-height: 20vh;
		position: relative;

		>view:nth-child(1) {
			font-size: 36rpx;
			line-height: 1;
			font-weight: bold;
			margin-bottom: 32rpx;
		}

		>.specList {
			margin-bottom: 20rpx;

			>view {
				@include flexs();
				flex-wrap: wrap;
				font-size: 24rpx;
				line-height: 1.5;

				&:nth-child(1) {
					font-size: 28rpx;
					margin-bottom: 20rpx;
				}

				&:nth-child(2) {
					>view {
						margin-bottom: 10rpx;
						@include flexs();
						margin-right: 10rpx;
						border-radius: 10rpx;
						overflow: hidden;
						border: 0.5px solid rgba(0, 0, 0, 0.1);
						line-height: 2;

						>view {
							padding: 0 10rpx;

							&:nth-child(2) {
								border-left: 1px solid rgba(0, 0, 0, 0.1);
								color: #f50000;
								background-color: #f5f5f5;
							}

							&:nth-child(1) {
								background-color: #f5f5f5;
							}
						}
					}

					>.specCheckList {
						border: 1px solid #fa690a;

						>view {
							&:nth-child(1) {
								color: #fa690a;
								background-color: #fff8f0;
							}

							&:nth-child(2) {
								border-left: 1px solid #fa690a;
								background-color: #fff8f0;
							}
						}
					}
				}
			}
		}
	}

	.specControl {
		width: 70%;
		color: #fff;
		font-size: 28rpx;
		height: 88rpx;
		line-height: 88rpx;
		border-radius: 60rpx;
		background-color: #fa690a;
		display: block;
		text-align: center;
		margin: 0 auto;
	}
}

.show {
	display: block;
}

.storeDet {
	>view {
		font-size: 28rpx;
		line-height: 2;
		font-weight: bold;
		text-align: center;
		margin-bottom: 20rpx;
	}
}

.swiperContent {
	width: calc(100% - 40rpx);
	background-color: #fff;
	margin: 0 20rpx 0 20rpx;
	border-radius: 20rpx;
	transform: rotate(0deg);
	-webkit-transform: rotate(0deg);
	overflow: hidden;

	/deep/swiper {
		height: 300rpx;
	}

	.imageContent {
		width: 100%;
		height: 100%;
		position: relative;

		image {
			position: absolute;
			left: 0;
			top: 0;
			bottom: 0;
			right: 0;
			max-width: 100%;
			max-height: 100%;
			margin: 0 auto;
			width: 100%;
			height: 100%;
		}
	}
}

.formContent {
	width: calc(100% - 40rpx);
	background-color: #fff;
	margin: 40rpx 20rpx 40rpx 20rpx;
	border-radius: 20rpx;
	padding: 20rpx;

	>view {
		font-size: 28rpx;
		margin-bottom: 10px;

		>view {
			&:nth-child(1) {
				margin-bottom: 10px;
			}
		}

		/deep/.u-input__right-icon--select {
			margin: calc((72rpx - 40rpx) / 2) 0 !important;
		}
	}
}

.button {
	width: calc(100% - 40rpx);
	border-radius: 10rpx;
	font-size: 32rpx;
	color: #fff;
	background-color: #fa690a;
	line-height: 2;
	text-align: center;
	padding: 10rpx 0;
	position: fixed;
	left: 20rpx;
	bottom: 130rpx;
}

.shopCarList {
	width: calc(100% - 40rpx);
	margin: 50rpx 20rpx;
	background-color: #fff;
	margin: 40rpx 20rpx 40rpx 20rpx;
	border-radius: 20rpx;
	padding: 20rpx;

	.title {
		margin-bottom: 20rpx;
		font-size: 32rpx;
	}

	.list {
		border-bottom: 1px solid #eee;
		padding: 20rpx 0;
		display: flex;
		justify-content: space-between;
		align-items: center;

		view:nth-child(1) {
			line-height: 2;
			font-size: 28rpx;
		}

		>view:nth-child(2) {
			width: 20%;
			@include flexs(center, center);
			color: #00000080;
			border-radius: 50rpx;
			border: 1px solid #eee;

			svg {
				margin: 0 10rpx;
			}

			view {
				width: 50rpx;
				height: 50rpx;
				text-align: center;
				line-height: 50rpx;
			}
		}

		&:last-child {
			border-bottom: 0;
		}
	}
}

/* 定义动画 */
@-webkit-keyframes show {
	0% {
		transform: rotateX(180deg);
		opacity: 0;
	}

	50% {
		transform: rotateX(25deg);
		opacity: 1;
	}

	60% {
		transform: rotateX(-25deg);
		opacity: 1;
	}

	70% {
		transform: rotateX(25deg);
		opacity: 1;
	}

	80% {
		transform: rotateX(-6deg);
		opacity: 1;
	}

	90% {
		transform: rotateX(6deg);
		opacity: 1;
	}

	100% {
		transform: rotateX(0);
		opacity: 1;
	}
}

.posiContent {
	>.listContent {
		margin-top: 10rpx;

		.list {
			padding: 34rpx 0;
			color: #000;
			font-size: 32rpx;
			line-height: 1;
			text-align: center;
		}

		&:last-child {
			border-bottom: 0;

			.list {
				border: 0;
			}
		}
	}
}
</style>
<style lang="scss">
.indexBig {
	.warn {
		/deep/.u-mode-center-box {
			min-height: auto;
		}
	}

	/deep/.u-mode-center-box {
		width: 90% !important;
		max-height: 80vh;
		padding: 40rpx 20rpx;
		border-radius: 20rpx;
		min-height: 30vh;
	}

	.alertBox {
		width: 100%;

		.title {
			font-size: 30rpx;
			text-align: center;
			font-weight: bold;
			line-height: 2;
		}

		.content {
			width: 90%;
			text-align: center;
			margin: 40rpx auto;
		}
	}
}

.showInput {
	/deep/.u-input__input {
		flex: 1;
		line-height: 50rpx;
		height: 50rpx;
		font-size: 28rpx;
		min-height: 50rpx !important;
		text-align: center;
	}
}

.imgContent {
	/deep/.u-wrap {
		image {
			position: absolute;
			left: 0;
			top: 0;
			bottom: 0;
			right: 0;
			max-width: 100%;
			max-height: 100%;
			margin: auto;
			width: auto !important;
			height: auto !important;
		}
	}
}

.posiBottom {
	/deep/.u-drawer-bottom {
		width: 100% !important;
		padding: 36rpx 20rpx 40rpx 20rpx;
		// border-top-left-radius: 40rpx;
		// border-top-right-radius: 40rpx;
		height: auto !important;
		min-height: 10vh;
		max-height: 80vh;
		overflow: auto;
	}

	/deep/ {
		.u-drawer__scroll-view {
			max-height: 80vh;
		}
	}
}
</style>
<style lang="scss" scoped>
$MaxWidth: 600px;

.button {
	max-width: 600px;
}

@media screen and (min-width: $MaxWidth) {
	.indexBig {
		width: $MaxWidth;
		margin: auto;

		/deep/.u-mode-center-box {
			max-width: $MaxWidth;
		}
	}

	.button {
		margin: auto;
		left: auto;
	}
}
</style>